import request from "@/utils/request";

// 查询组件表列表
export function listComponents(query) {
  return request({
    url: "/admin/assets/components/",
    method: "get",
    params: query
  });
}

// 查询组件表详细
export function getComponents(id) {
  return request({
    url: "/admin/assets/components/" + id + "/",
    method: "get"
  });
}

// 新增组件表
export function addComponents(data) {
  return request({
    url: "/admin/assets/components/",
    method: "post",
    data: data
  });
}

// 修改组件表
export function updateComponents(data) {
  return request({
    url: "/admin/assets/components/" + data.id + "/",
    method: "put",
    data: data
  });
}

// 删除组件表
export function delComponents(id) {
  return request({
    url: "/admin/assets/components/" + id + "/",
    method: "delete"
  });
}

// 导出组件表
export function exportComponents(query) {
  return request({
    url: "/admin/assets/components/export/",
    method: "get",
    params: query
  });
}

// 借出
export function componentCheckout(data) {
  return request({
    url: "/admin/assets/componentcheckout/",
    method: "post",
    data: data
  });
}

// 归还
export function componentCheckin(data) {
  return request({
    url: "/admin/assets/componentcheckin/",
    method: "post",
    data: data
  });
}

// 查询组件的借还记录
export function listComponentrecords(query) {
  return request({
    url: "/admin/assets/componentrecords/",
    method: "get",
    params: query
  });
}

export function importsComponents(data) {
  return request({
    url: "/admin/assets/components/import/",
    method: "post",
    data: data
  });
}
